<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
   
</head>
<body>
    <script>
        //用promiss加载图片
        function img_lode(file) {
  return new Promise((resolve, reject) => {
    let img = document.createElement('img')
   
    img.src = file
    img.onload = resolve;
    img.onerror = reject;
    document.body.appendChild(img);
  })
}

img_lode('../img/fenche.png')
  .then(() => console.log('加载成功'))
  .catch((error) => console.log(`${error.target.src} 加载失败`))
    
    
    </script>
    
</body>
</html>